package com.andon.colbert.ffplayer;

import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.SurfaceView;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    private FFPlayer player;

    private SurfaceView surfaceView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        surfaceView = (SurfaceView) findViewById(R.id.surface_view);
        surfaceView.setKeepScreenOn(true);
        player = new FFPlayer();
        player.setSurfaceView(surfaceView);
    }

    public void playVideo(View view) {
        player.playVideo("rtmp://live.hkstv.hk.lxdns.com/live/hks");
//        player.playVideo(Environment.getExternalStorageDirectory() + "/input.mp4");
    }

    public void stopVideo(View v) {
        player.release();
    }
}
